package com.zr.serviceimpl;

import java.util.Iterator;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zr.dao.DeliverypointDaoLPN;
import com.zr.dao.DistributionscopeDaoLPN;
import com.zr.service.DistributionscopeServiceLPN;
import com.zr.vo.Dp_DsVO;
import com.zr.vo.Drp_dpVO;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@Service("dss")
public class DistributionscopeServiceImplLPN implements DistributionscopeServiceLPN{
	//属性注入
	@Resource
	private DistributionscopeDaoLPN dsDao ;
	
	@Override
	public JSONArray findDS(int dpId) {
	JSONArray j = new JSONArray();
	List<Dp_DsVO> dp = dsDao.findDS(dpId);
	for (Dp_DsVO dp_DsVO : dp) {
		JSONObject js=new JSONObject();		
		js.put("dsId",dp_DsVO.getDsId());
		js.put("dsName",  dp_DsVO.getDsName());
		js.put("dsDate",  dp_DsVO.getDsDate());
		js.put("dsRemarks", dp_DsVO.getDsRemarks());
		js.put("dpId", dp_DsVO.getDpId());
		js.put("dpName", dp_DsVO.getDpName());
		j.add(js);
	}
		
		return j;
	}

	@Override
	public JSONArray getDSByUid(int page,int rows,int uid) {
		
		return dsDao.getDSByUid(page, rows, uid);
	}

	public boolean insertDS(String dsName, String dsRemarks, int dpId,String dsDate) {
		// TODO Auto-generated method stub
		return dsDao.insertDS(dsName, dsRemarks, dpId, dsDate);
	}

	@Override
	public int finddsIdBydpIdAndsName(int dpId, String dsName) {
		// TODO Auto-generated method stub
		return dsDao.finddsIdBydpIdAndsName(dpId, dsName);
	}

	@Override
	public int updateDS(int dsId,String dsName, String dsRemarks, String dsDate) {
		// TODO Auto-generated method stub
		return dsDao.updateDS(dsId, dsName, dsRemarks, dsDate);
	}

	@Override
	public JSONArray getAllDS(int page,int rows) {
		// TODO Auto-generated method stub
		return dsDao.getAllDS(page, rows);
	}
		
}
